home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef _MAININCLUDES_
- #include "main.h"
- #endif
-
- void MyMoveSprites (void)
- {
- short nIndex;
- MatrixRecord matrix;
-
- SetIdentityMatrix(&matrix);
-
- // for each sprite
- for (nIndex = 0; nIndex < kNumSprites; nIndex++) {
-
- // modify the sprite’s matrix
- OffsetRect(&gDestRects[nIndex], gDeltas[nIndex].h,
- gDeltas[nIndex].v);
-
- if ((gDestRects[nIndex].right >= gBounceBox.right) ||
- (gDestRects[nIndex].left <= gBounceBox.left))
- gDeltas[nIndex].h = -gDeltas[nIndex].h;
-
- if ((gDestRects[nIndex].bottom >= gBounceBox.bottom) ||
- (gDestRects[nIndex].top <= gBounceBox.top))
- gDeltas[nIndex].v = -gDeltas[nIndex].v;
-
- matrix.matrix[2][0] = ((long)gDestRects[nIndex].left << 16);
- matrix.matrix[2][1] = ((long)gDestRects[nIndex].top << 16);
-
- // Step 4.
- // Insert "SetSpriteMatrix.clp" here
-
-
- // change the sprite’s image
- gCurrentImages[nIndex]++;
- if (gCurrentImages[nIndex] >= (kNumSpaceShipImages *
- (nIndex+1)))
- {
- gCurrentImages[nIndex] = 0;
- }
-
- // Step 5.
- // Insert "SetSpriteImage.clp" here
-
- }
- }